import axios from "axios"
const http = axios.create({
  baseURL: `http://localhost:3003`,
  timeout: 10000,
})
export function getArticles({ page, size }) {
  return http({
    url: `/articles?_page=${page}&_limit=${size}&_sort=id&_order=desc`
  })
}
export function getArticle(id) {
  return http({ url: `/articles/${id}` });
}
export function createArticle(data) {
  return http({
    method: 'POST',
    url: `/articles`,
    data
  });
}
export function updateArticle(id, data) {
  return http({
    method: 'PUT',
    url: `/articles/${id}`,
    data
  });
}
 export function delArticle(id) {
    return http({
      method: 'DELETE',
      url: `/articles/${id}`,
    });
  }